{%- if not is_single_detail -%}
{{ indent * level }}else
{{ indent * level }}{
{%- set level = level + 1 -%}
{%- endif %}
{{ indent * level }}error = exi_basetypes_encoder_nbit_uint(stream, {{ bits_to_write }}, {{ value_to_write }});
{{ indent * level }}if (error == EXI_ERROR__NO_ERROR)
{{ indent * level }}{
{{ indent * (level + 1) }}{{ event_comment }}
{{ indent * (level + 1) }}done = 1;
{{ indent * (level + 1) }}grammar_id = {{ next_grammar }};
{{ indent * level }}}
{%- if not is_single_detail %}
{{ indent * (level - 1) }}}
{%- endif %}
